package com.hdit.guimei.util;

import java.util.List;

/**
 * @author 冰镇小可乐
 * @ClassNamePageListUtil
 * @Description TODO
 * @Date 2021/1/21 14:44
 * Version 1.0
 */
public class PageListUtil {
    public  static List Util(List objectList,int pageNum,int pageSize){
        int count=0;
        int fromIndex=0;
        int toIndex=0;
        if (pageNum<1){
            pageNum=1;
        }
        if (objectList!=null&&objectList.size()>0){
             count=objectList.size();
             fromIndex=(pageNum-1)*pageSize;
             toIndex=pageNum*pageSize;
            if (toIndex>count){
                toIndex=count;
            }
        }
        List list =objectList.subList(fromIndex,toIndex);
        return  list;
    }
}
